package org.restoran.service.parser.dto;

import org.modelmapper.ModelMapper;
import org.restoran.model.Order;
import org.restoran.model.OrderStatus;
import org.restoran.model.Table;
import org.restoran.model.TableStatus;

import java.util.Date;
import java.util.Set;

/**
 * @author Snisar Bogdan.
 */
public class OrderDTO {
    private Integer id;
    private String description;
    private Date openDate;
    private Date closeDate;
    private OrderStatus orderStatus;

    private Integer tableId;
    private Set<ItemOrderDTO> items;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getOpenDate() {
        return openDate;
    }

    public void setOpenDate(Date openDate) {
        this.openDate = openDate;
    }

    public Date getCloseDate() {
        return closeDate;
    }

    public void setCloseDate(Date closeDate) {
        this.closeDate = closeDate;
    }

    public OrderStatus getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(OrderStatus orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Integer getTableId() {
        return tableId;
    }

    public void setTableId(Integer tableId) {
        this.tableId = tableId;
    }

    public Set<ItemOrderDTO> getItems() {
        return items;
    }

    public void setItems(Set<ItemOrderDTO> items) {
        this.items = items;
    }


    public static void main(String[] args) {
        ModelMapper modelMapper = new ModelMapper();
        Order order = new Order();

        Table d = new Table();
        d.setX(1);
        d.setY(3);
        d.setName("Desk_1");
        d.setStatus(TableStatus.FREE);


        Order o = new Order();
        o.setOpenDate(new Date());
        o.setStatus(OrderStatus.OPENED);
        o.addTable(d);



        OrderDTO orderDTO = modelMapper.map(order, OrderDTO.class);
        System.out.println(orderDTO);
    }

    @Override
    public String toString() {
        return "OrderDTO{" +
                "id=" + id +
                ", description='" + description + '\'' +
                ", openDate=" + openDate +
                ", closeDate=" + closeDate +
                ", orderStatus=" + orderStatus +
                ", tableId=" + tableId +
                ", items=" + items +
                '}';
    }
}
